;;
;; Defines activity template for the rule engine.
;;
;; author  : Hongbing Kou
;;

(provide ActivityTemplate)

;; Action template.
(deftemplate Activity
    "Common parts of all types of activities"
    (slot index) ; Order of the activity in the microprocess
    (slot file)  ; Object of file that this activity is associated with.
)

;; Edit activity
(deftemplate EditActivity extends Activity
    "File edit activity"
    (slot duration (default 0)) ; Total edit time.
    (slot byteChange (default 0)) ; Number of bytes change
)

;; Document edit activity
(deftemplate DocumentEditActivity extends EditActivity
   "Documentation edit activity"
)

;; Production code edit activity
(deftemplate ProductionEditActivity extends EditActivity
   "Java production code edit activity"
   (slot methodChange (default 0))
   (slot statementChange (default 0))
)

;; Unit test edit activity
(deftemplate UnitTestEditActivity extends EditActivity
    "Unit test edit activity"
    (slot testChange (default 0))
    (slot assertionChange (default 0))
)

;; Unit test code invocation
(deftemplate UnitTestActivity extends Activity
    "Unit test execution"
    (slot errmsg (default nil))
)

;; Defines compilation error activity
(deftemplate CompilationActivity extends Activity
    "Compilation error"
    (slot message)
)

;; Buffer transition activity
(deftemplate BufferTransActivity extends Activity
    "Buffer transition"
    (slot leavingFile)
)

;; Unary refactor activity
(deftemplate UnaryRefactorActivity extends Activity
    "Changes on java structures"
    (slot operation)  ; add or delete
    (slot type)       ; class, field or method
    (slot data)       ; class, field or method name. 
)

;; Binary refactor activity
(deftemplate BinaryRefactorActivity extends Activity
    "Rename a class, field or method."
    (slot operation)  ; Move or rename
    (slot type)       ; class, field or method
    (slot from)       ; Change from
    (slot to)         ; Change to
)

; Debug activity
(deftemplate DebugActivity extends Activity
    "Code debugging"
    (slot operation) ; Debug operation
    (slot location)  ; Debugged location
)